const { obd_collection } = require('../config')
const { region_collection } = require('../config')
const { grid_collection } = require('../config')
const { db } = require('../config')
const { command } = require('../config')
const _ = command
// 通过获取所有obd经纬度计算网格内的obd中心点
exports.main = async (event, context) => {
    const regionInfo = await db.collection(region_collection).get();
    var regionArr = [];
    for (region of regionInfo.data) {
        regionArr[region.region] = [region.center.lat, region.center.lng]
    }
    const gridInfo = await db.collection(grid_collection).get();
    var gridArr = [];
    for (grid of gridInfo.data) {
        gridArr[grid.grid] = [grid.center.lat, grid.center.lng]
    }
    return { regionCenter: regionArr, gridCenter: gridArr };
}